<?php
namespace Bus\Controller;
use Think\Controller;
class StationController extends Controller {

	function station($id=1){
			//echo $station_name;

			//$id = $_GET['id'];
			if($_GET['id'])
			{
				$station_name=D('qr')->where("QR_Id=$id")->getField('station_name');
			}
			//session('stationname',$station_name);
			//echo I('get.stationname');
			$station=D('station_info');
			//$station->field('did,station_name');
			$station->where("(station_name='$station_name' or station_name='{$station_name}口') and name not like '%停运%'")
				->join('ad_line_up_down ON ad_station_info.line_detail_id=ad_line_up_down.did');
			//$station->limit(5);
			//$station->order('did desc');

			$info=$station->select();

			//$info=$station->field('did,station_name')->limit(5)->where('条件')->select();
			//各方法没有先后顺序，select()放最后即可
			//dump($info);

			$info['datenum']=time();
			$info['remainder']=$info['datenum'] % 2;

			$this->assign('buslist',$info);
			layout('base');
			$this->display();

	}

	public function stationt6($id=1)
	{
			if($_GET['id'])
			{
				$station_id=D('qr')->where("QR_Id=$id")->getField('station_id');
			}

			$this->assign('stationId',$station_id);
			$this->display();

	}

    public function pay(){
         $this->display();
    }

	function station8($station_name){
		$station_name = $_GET['station_name'];
		$station_name =mb_convert_encoding($station_name,"utf-8", "gb2312");
		$info=D('qr')->where("station_name like '%$station_name%'")->getField('QR_Id');
		$this->redirect('/Bus/Station/station/id/'.$info,'',0,'纯跳转');
	}


	public function station3($id=1){
		if($_GET['id'])
		{
			$station_name=D('qr')->where("QR_Id=$id")->getField('station_name');
		}
		$station=D('station_info');
		$station->where("(station_name='$station_name' or station_name='{$station_name}口') and name not like '%停运%'")->join('ad_line_up_down ON ad_station_info.line_detail_id=ad_line_up_down.did');
		$info=$station->select();
		$info2['datenum']=time();
		$info2['remainder']=$info2['datenum'] % 2;
		$info2['id']=$id;
		//dump($info2['id']);
		// $path="/Public/images/";
		// $type="";
		// if($id>100)
		// {
		// 	$type="a.jpg";
		// }
		// else
		// {
		// 	$type="g.jpg";
		// }
		// $file=$path.$id.$type;
		// $tmplContent = str_replace('__ROOT__',__ROOT__,$tmplContent);
		// dump($tmplContent);
		// if(!file_exists($file))
		// {
		// 	$info2['id']=0;
		// }
		//dump($info2['id']);
		$this->assign('buslist',$info);
		$this->assign('buslist2',$info2);
		layout('base');
		$this->display();
	}



}
